package com.rybbaby.tss.platform.sysRoleJoinSysMenuPermissions.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Version;

import com.rybbaby.tss.core.utils.StringUtils;
import com.rybbaby.tss.platform.sysMenuPermissions.entity.SysMenuPermissions;
import com.rybbaby.tss.platform.sysRole.entity.SysRole;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;


/**
 * @description 权限所属角色
 * 
 * @author 谢进伟
 * 
 * @createDate 2016-08-19 上午11:36:25
 */
@Entity
@Table(name = "sys_role_join_sys_menu_permissions")
@DynamicUpdate(true)
@DynamicInsert(true)
public class SysRoleJoinSysMenuPermissions implements Serializable {
	
	private static final long serialVersionUID = 355090823498873L;
	
	/** 主键 **/
	private String id;
	/** 角色Id **/
	private String roleId;
	/** 权限Id **/
	private String menuPermissionId;
	/** 创建时间 **/
	private java.sql.Timestamp createTime;
	/** 创建人Id **/
	private String createUserId;
	/** 权重 **/
	private Integer weight;
	/** 版本 **/
	private Integer version;
	/** 角色Id **/
	private SysRole role;
	/** 权限Id **/
	private SysMenuPermissions menuPermissions;
	
	/**
	 * 方法: 取得角色Id
	 *
	 * @return SysRole 角色Id
	 */
	@JoinColumn(name = "roleId" , insertable = false , updatable = false)
	@ManyToOne(fetch = FetchType.LAZY , targetEntity = SysRole.class)
	public SysRole getRole() {
		return this.role;
	}
	
	/**
	 * 方法: 设置角色Id
	 *
	 * @param role 角色Id
	 */
	public void setRole(SysRole role) {
		this.role = role;
	}
	
	/**
	 * 方法: 取得权限Id
	 *
	 * @return SysMenuPermissions 权限Id
	 */
	@JoinColumn(name = "menuPermissionsId" , insertable = false , updatable = false)
	@ManyToOne(fetch = FetchType.LAZY , targetEntity = SysMenuPermissions.class)
	public SysMenuPermissions getMenuPermissions() {
		return this.menuPermissions;
	}
	
	/**
	 * 方法: 设置权限Id
	 *
	 * @param menuPermissions 权限Id
	 */
	public void setMenuPermissions(SysMenuPermissions menuPermissions) {
		this.menuPermissions = menuPermissions;
	}
	
	/**
	 * 方法: 取得主键
	 *
	 * @return java.lang.String 主键
	 */
	@Id
	@GeneratedValue(generator = "sys_role_join_sys_menu_permissionsIDGenerator" , strategy = GenerationType.AUTO)
	@GenericGenerator(name = "sys_role_join_sys_menu_permissionsIDGenerator" , strategy = "uuid")
	@Column(name = "id", nullable= false, length = 32)
	public String getId() {
		return this.id;
	}
	
	/**
	 * 方法: 设置主键
	 *
	 * @param id 主键
	 */
	public void setId(String id) {
		this.id = id;
	}
	
	/**
	 * 方法: 取得角色Id
	 *
	 * @return java.lang.String 角色Id
	 */
	@Column(name = "roleId", nullable= true, length = 32)
	public String getRoleId() {
		return this.roleId;
	}
	
	/**
	 * 方法: 设置角色Id
	 *
	 * @param roleId 角色Id
	 */
	public void setRoleId(String roleId) {
		this.roleId = StringUtils.isBlank(roleId) ? null : roleId;
	}
	
	/**
	 * 方法: 取得权限Id
	 *
	 * @return java.lang.String 权限Id
	 */
	@Column(name = "menuPermissionsId", nullable= true, length = 32)
	public String getMenuPermissionId() {
		return this.menuPermissionId;
	}
	
	/**
	 * 方法: 设置权限Id
	 *
	 * @param menuPermissionId 权限Id
	 */
	public void setMenuPermissionId(String menuPermissionId) {
		this.menuPermissionId = StringUtils.isBlank(menuPermissionId) ? null : menuPermissionId;
	}
	
	/**
	 * 方法: 取得创建时间
	 *
	 * @return java.sql.Timestamp 创建时间
	 */
	@Column(name = "createTime", nullable= true, length = 19)
	public java.sql.Timestamp getCreateTime() {
		return this.createTime;
	}
	
	/**
	 * 方法: 设置创建时间
	 *
	 * @param createTime 创建时间
	 */
	public void setCreateTime(java.sql.Timestamp createTime) {
		this.createTime = createTime;
	}
	
	/**
	 * 方法: 取得创建人Id
	 *
	 * @return java.lang.String 创建人Id
	 */
	@Column(name = "createUserId", nullable= true, length = 32)
	public String getCreateUserId() {
		return this.createUserId;
	}
	
	/**
	 * 方法: 设置创建人Id
	 *
	 * @param createUserId 创建人Id
	 */
	public void setCreateUserId(String createUserId) {
		this.createUserId = createUserId;
	}
	
	/**
	 * 方法: 取得权重
	 *
	 * @return java.lang.Integer 权重
	 */
	@Column(name = "weight", nullable= true, length = 11)
	public Integer getWeight() {
		return this.weight;
	}
	
	/**
	 * 方法: 设置权重
	 *
	 * @param weight 权重
	 */
	public void setWeight(Integer weight) {
		this.weight = weight;
	}
	
	/**
	 * 方法: 取得版本
	 *
	 * @return java.lang.Integer 版本
	 */
    @Version
	@Column(name = "version", nullable= true, length = 11)
	public Integer getVersion() {
		return this.version;
	}
	
	/**
	 * 方法: 设置版本
	 *
	 * @param version 版本
	 */
	public void setVersion(Integer version) {
		this.version = version;
	}
}